100 int i,i1,i2,i3,i4,i5,i6,i7,x,xx,xx1,y,yy,a,b,c,tim,col=7,m1,m2,m3,m4,no,no1,no2,no3,st,st1,bu,bu1=2,bu2=1,mx,my,pow1,pow2,pon1,pon2,jp1,jp2,cn,bol,bol1
110 int ji1,ji2,ji3,ji4,ji5,ji6,ji7,ji8,jia,jib,jca,jcb,jc1,jc2,jc3,jc4,jc5,jc6,jc7,jc8,p1,p2,p3,p4,wait1,z,z1,z2,r,r1,r2,rx,ry,ra,rb,m=1,n=0,iro,nn,lmx=100
115 int pi1,pi2,pi3,pi4,pc1,pc2,pc3,pc4,tim1,mog,mox,moy,moc,spd,gm,pt1,pt2,sj,sjx,sjy,mno=1,kage,kage1,kmax,sc,dmg,life,gc,tres1,smode=0
120 dim int map(5,500,31),mapdata(16000),kagex(20),kagey(20),kagec(20),kagem(20),hit(10),mk(5),g(1000),bx(30),by(30),ba(30),bb(30),bc(30)
130 dim char tres(5,3000),tresd(15100)
135 dim str smo(2)={"NO USE","AUTO SAVE","NO USE"},trigm(2)={"","A:1 B:2","B:1 A:2"},trs(2)={"RECORD","PLAY "}
150 dim int ch_l(13,3)={48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,16433,16432,16435,16434,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82
2012 if bu=bu1 or st=3 or st=6 or st=9 then m3=1:m4=0 else if bu=bu2 or st=1 or st=4 or st=7 then m3=0:m4=1
2013 if tres1=0 then tres(mno,tim1)=abs(m3)*10+abs(m4) else if tres1=1 then m3=int(tres(mno,tim1)/10):m4=(tres(mno,tim1) mod 10)
2015 ik=inkey$(0):if ik=chr$(3) or ik="q" or ik="Q" then goto 2900 else if ik=chr$(12) then sp_disp(0):cls:goto 2900
2016 if ik="E" or ik="e" or ik="イ" then edt() else if ik=chr$(27) then pause()
2017 if ik="=" then bol=int(rnd()*1000):bol1=bol:stclr()
2020 if (ji7<40 or ji8<40) and m3<>0 and pow1<30 and pow2=0 and jp1=0 and jp2=0 then pow1=pow1+1:pow2=0:no=7:no1=0:goto 2030
2022 if (ji5<40 or ji6<40) and m4<>0 and pow1=0 and pow2<30 and jp1=0 and jp2=0 then pow2=pow2+1:pow1=0:no=7:no1=1:goto 2030
2025 if (ji1<40 or ji2<40 or y=224) and m3<>0 and pow1<30 and jp1=0 and jp2=0 then pow1=pow1+1:pow2=0:no=8:no1=0:xx=0 else if (ji1<40 or ji2<40 or y=224) and m4<>0 and pow2<30 and jp1=0 and jp2=0 then pow2=pow2+1:pow1=0:no=8:no1=1:xx=0
2030 if pow1>=30 and m3=0 then sj=1:sjx=-8:sjy=y:jp1=0:pow1=0:hitclr() else if pow1>0 and pow1<30 and m3=0 then jp1=1:xx1=int(pow1/cn)*2+2:pow1=0:hitclr()
2032 if pow2>=30 and m4=0 then sj=1:sjx=8:sjy=y:jp2=0:pow2=0:hitclr() else if pow2>0 and pow2<30 and m4=0 then jp2=1:xx1=int(pow2/cn)*2+2:pow2=0:hitclr()
2035 /*locate 3,0:print using"### ###";pow1,pow2
2040 if pow1>0 then pon1=int(pow1/cn):sp_on(14,14):sp_set(14,x+24,y+20,100+pon1+256*col) else if pow2>0 then pon2=int(pow2/cn):sp_on(14,14):sp_set(14,x-8,y+20,100+pon2+256*col) else sp_off(14,14)
2050 if jp1>0 then xx=-xx1:yy=jp(jp1,0)+int(jp(jp1,0)/2)*(xx1-3):no=jp(jp1,1):jp1=jp1+1
2051 if jp2>0 then xx=xx1:yy=jp(jp2,0)+int(jp(jp2,0)/2)*(xx1-3):no=jp(jp2,1):jp2=jp2+1
2055 if jp1>20 then jp1=0
2056 if jp2>20 then jp2=0
2060 if sj=1 then xx=sjx:yy=0:no=9
2070 if xx<0 and (ji5<40 or ji6<40) then xx=0 else if xx>0 and (ji7<40 or ji8<40) then xx=0
2080 if y<50 then spd=0 else if y<120 then spd=1 else spd=5
2085 tim1=tim1+1:if spd=0 then srol1():srol1():srol1():srol1():srol1() else if (tim1 mod spd)=0 then srol1()
2100 x=x+xx:y=y+yy:if x<22 then x=22 else if x>232 then x=232
2110 if y<16 then y=16 else if y>224 then y=224:jp1=0:jp2=0
2115 if y=224 and life>0 then life=life-1:mes=left$(str$(life)+" ",3):mog=0:mox=19:moy=31:moc=3:jiput()
2118 if life=0 then bg_fill(1,256):home(0,0,256):kyin():hi_put():lmx=100:goto 2900
2120 if no1=0 then sp_on(10,13):sp_set(10,x,y+4,ch_l(no,0)+col*256):sp_set(11,x+16,y+4,ch_l(no,1)+col*256):sp_set(12,x,y+20,ch_l(no,2)+col*256):sp_set(13,x+16,y+20,ch_l(no,3)+col*256)
2125 /*
2130 if no1<>0 then sp_on(10,13):sp_set(10,x,y+4,ch_r(no,0)+col*256):sp_set(11,x+16,y+4,ch_r(no,1)+col*256):sp_set(12,x,y+20,ch_r(no,2)+col*256):sp_set(13,x+16,y+20,ch_r(no,3)+col*256)
2140 if xx=0 and yy=0 and no=10 and (ji1=36 or ji1=37 or ji1=38 or ji1=39 or ji2=36 or ji2=37 or ji2=38 or ji2=39) then stclr()
2150 if kmax>0 then kg_put()
2200 ji1=bg_get(m,int((x-4)/8),((int((y+24)/8)+(63-int(z1/8))+0) mod 64)):jc1=int(ji1/256):ji1=(ji1 mod 256)
2201 ji2=bg_get(m,int((x-4)/8)+1,((int((y+24)/8)+(63-int(z1/8))+0) mod 64)):jc2=int(ji2/256):ji2=(ji2 mod 256)
2202 ji3=bg_get(m,int((x-8)/8),((int((y+34)/8)+(63-int(z1/8))+0) mod 64)):jc3=int(ji3/256):ji3=(ji3 mod 256)
2203 ji4=bg_get(m,int((x+0)/8)+1,((int((y+34)/8)+(63-int(z1/8))+0) mod 64)):jc4=int(ji4/256):ji4=(ji4 mod 256)
2204 ji5=bg_get(m,int((x-0)/8)-1,((int((y+8)/8)+(63-int(z1/8))) mod 64)):jc5=int(ji5/256):ji5=(ji5 mod 256)
2205 ji6=bg_get(m,int((x-0)/8)-1,((int((y+8)/8)+(63-int(z1/8))+1) mod 64)):jc6=int(ji6/256):ji6=(ji6 mod 256)
2206 ji7=bg_get(m,int((x)/8)+1,((int((y+8)/8)+(63-int(z1/8))) mod 64)):jc7=int(ji7/256):ji7=(ji7 mod 256)
2207 ji8=bg_get(m,int((x)/8)+1,((int((y+8)/8)+(63-int(z1/8))+1) mod 64)):jc8=int(ji8/256):ji8=(ji8 mod 256)
2209 /*
2210 if m4<>0 and (ji5<40 or ji6<40) and xx<=0 then xx=0:yy=0:jp1=0:jp2=0:no=7:no1=1:sj=0 else if m3<>0 and (ji7<40 or ji8<40) and xx>=0 then xx=0:yy=0:jp1=0:jp2=0:no=7:no1=0:sj=0 else if m3=0 and m4=0 and no=7 then no=5
2215 if (ji5<40 or ji6<40) and xx<=0 and sj>0 then xx=0:yy=0:jp1=0:jp2=0:no=5:no1=1:sj=0 else if (ji7<40 or ji8<40) and xx>=0 and sj>0 then xx=0:yy=0:jp1=0:jp2=0:no=7:no1=0:sj=0
2219 /*
2220 if (jp1>7 or jp2>7 or yy>0) and sj=0 and (ji1<40 or ji2<40) then jp1=0:jp2=0:no=10:xx=0:yy=0 else if jp1=0 and jp2=0 and sj=0 and ji1>39 and ji2>39 and no<>7 then xx=0:yy=8:no=5
2225 if jp1=0 and jp2=0 and sj=0 and ji1<40 and ji2<40 and no<>10 then xx=0:yy=0:no=10
2230 if yy>0 and (ji1<40 or ji2<40) then jp1=0:jp2=0:yy=0:no=5 else if yy>8 and (ji3<40 or ji4<40) then jp1=0:jp2=0:yy=8:no=5
2240 if xx<0 and (ji5<40 or ji6<40) then xx=0:sj=0 else if xx>0 and (ji7<40 or ji8<40) then xx=0:sj=0
2245 if (ji1<40 or ji2<40) and jp1=0 and jp2=0 and sj=0 then y=int(y/8)*8+((int(r/4)) mod 8):no=10
2300 /*
2310 /*
2400 i2=int(x/8)-1:i3=((int(y/8)+(63-int(z1/8))+0) mod 64)
2405 pi1=bg_get(1,i2,i3):pc1=int(pi1/256):pi1=(pi1 mod 256):if pi1>55 and pi1<60 then l_on()
2409 /*
2410 i2=int(x/8)+1:i3=((int(y/8)+(63-int(z1/8))+0) mod 64)
2415 pi1=bg_get(1,i2,i3):pc1=int(pi1/256):pi1=(pi1 mod 256):if pi1>55 and pi1<60 then l_on()
2419 /*
2420 i2=int(x/8)-1:i3=((int(y/8)+(63-int(z1/8))+2) mod 64)
2425 pi1=bg_get(1,i2,i3):pc1=int(pi1/256):pi1=(pi1 mod 256):if pi1>55 and pi1<60 then l_on()
2429 /*
2430 i2=int(x/8)+1:i3=((int(y/8)+(63-int(z1/8))+2) mod 64)
2435 pi1=bg_get(1,i2,i3):pc1=int(pi1/256):pi1=(pi1 mod 256):if pi1>55 and pi1<60 then l_on()
2439 /*
2450 if mk(0)>0 then mk(0)=mk(0)-1:sp_on(5,7):i=mk(2)+(tim1 mod 2):sp_set(5,mk(1),i,mk(3)):sp_set(6,mk(1)+16,i,mk(4)):sp_set(7,mk(1)+32,i,mk(5)) else sp_off(5,7)
2500 /*srol1()
2700 /*if y<50 then spd=0 else if y<120 then spd=1 else spd=5
2710 /*tim1=tim1+1:if spd=0 then srol1():srol1():srol1():srol1():srol1() else if (tim1 mod spd)=0 then srol1()
3120 if ik<>"" or bu<>0 or m3<>0 or m4<>0 then goto 3110
3121 tim=tim+1:if (tim mod 2)=0 then goto 3122 else goto 3124
3122 if (gc-1)>=(no3) then bx(no)=(no3 mod 32)*8+16:by(no)=int(no3/32)*8+16:bc(no)=g(no3):ba(no)=int(rnd()*8-3):bb(no)=1:bg_put(1,(no3 mod 32),int(no3/32),256):no=no+1:no3=no3+1
3506 if no1=0 then sp_on(10,13):sp_set(10,x,y+4,ch_l(no,0)+col*256):sp_set(11,x+16,y+4,ch_l(no,1)+col*256):sp_set(12,x,y+20,ch_l(no,2)+col*256):sp_set(13,x+16,y+20,ch_l(no,3)+col*256)
3507 if no1<>0 then sp_on(10,13):sp_set(10,x,y+4,ch_r(no,0)+col*256):sp_set(11,x+16,y+4,ch_r(no,1)+col*256):sp_set(12,x,y+20,ch_r(no,2)+col*256):sp_set(13,x+16,y+20,ch_r(no,3)+col*256)
3510 ik=inkey$(0):if ik<>"" then goto 3510
3520 ik=inkey$(0):if ik="" then goto 3520 else if ik=chr$(27) then goto 3580
3530 if ik="1" or ik="2" or ik="3" or ik="4" or ik="5" or ik="6" or ik="7" then col=val(ik):goto 3506
3540 if ik="W" or ik="w" or ik="テ" then sp_disp(0):locate 4,0:print"WAIT=("+str$(wait1)+") =";:input wait1:sp_disp(1)
3550 if ik="K" or ik="k" or ik="ノ" then sp_disp(0):locate 4,0:print"KAGE("+str$(kmax)+") =";:input kmax:sp_disp(1)
3810 i4=pi1:i5=pc1:hit(5)=hit(4):hit(4)=hit(3):hit(3)=hit(2):hit(2)=hit(1):hit(1)=i5:hit(0)=hit(0)+1:if hit(0)>5 then hit(0)=5
3815 for i=1 to hit(0):bg_put(0,23+i,31,256*hit(i)+2):next
3816 if hit(1)>0 and hit(2)>0 and hit(3)>0 and hit(4)>0 and hit(5)>0 then sc=sc+100:mk(0)=20:mk(1)=x+8:mk(2)=y:mk(3)=104+256*i5:mk(4)=256*i5+127:mk(5)=256*i5+127
3820 if hit(1)=hit(2) and hit(2)=hit(3) and hit(3)=hit(4) and hit(4)=hit(5) then sc=sc+500:mk(0)=20:mk(1)=x-16:mk(2)=y:mk(3)=105+256*i5:mk(4)=256*i5+106:mk(5)=256*i5+107
3824 i6=i3+1:if i6>63 then i6=i6-64
3825 i7=i3-1:if i7<0 then i7=i7+64
3830 if (pi1 mod 4)=0 then bg_put(m,i2,i6,61+256*i5):bg_put(m,i2+1,i6,63+256*i5):bg_put(m,i2,i3,60+256*i5):bg_put(m,i2+1,i3,62+256*i5)
3840 if (pi1 mod 4)=1 then bg_put(m,i2,i3,61+256*i5):bg_put(m,i2+1,i3,63+256*i5):bg_put(m,i2,i7,60+256*i5):bg_put(m,i2+1,i7,62+256*i5)
3850 if (pi1 mod 4)=2 then bg_put(m,i2-1,i6,61+256*i5):bg_put(m,i2,i6,63+256*i5):bg_put(m,i2-1,i3,60+256*i5):bg_put(m,i2,i3,62+256*i5)
3860 if (pi1 mod 4)=3 then bg_put(m,i2-1,i3,61+256*i5):bg_put(m,i2,i3,63+256*i5):bg_put(m,i2-1,i7,60+256*i5):bg_put(m,i2,i7,62+256*i5)
4120 no2=0:if sc>hsc(10) and tres1=0 then no2=10:goto 4130 else goto 4210
4130 if sc>hsc(1) then for i=0 to 8:hsc(10-i)=hsc(9-i):hina(10-i)=hina(9-i):hico(10-i)=hico(9-i):next:hsc(1)=sc:hina(1)="":hico(1)=col:no2=1:goto 4210
4132 if sc>hsc(2) then for i=0 to 7:hsc(10-i)=hsc(9-i):hina(10-i)=hina(9-i):hico(10-i)=hico(9-i):next:hsc(2)=sc:hina(2)="":hico(2)=col:no2=2:goto 4210
4134 if sc>hsc(3) then for i=0 to 6:hsc(10-i)=hsc(9-i):hina(10-i)=hina(9-i):hico(10-i)=hico(9-i):next:hsc(3)=sc:hina(3)="":hico(3)=col:no2=3:goto 4210
4136 if sc>hsc(4) then for i=0 to 5:hsc(10-i)=hsc(9-i):hina(10-i)=hina(9-i):hico(10-i)=hico(9-i):next:hsc(4)=sc:hina(4)="":hico(4)=col:no2=4:goto 4210
4138 if sc>hsc(5) then for i=0 to 4:hsc(10-i)=hsc(9-i):hina(10-i)=hina(9-i):hico(10-i)=hico(9-i):next:hsc(5)=sc:hina(5)="":hico(5)=col:no2=5:goto 4210
4140 if sc>hsc(6) then for i=0 to 3:hsc(10-i)=hsc(9-i):hina(10-i)=hina(9-i):hico(10-i)=hico(9-i):next:hsc(6)=sc:hina(6)="":hico(6)=col:no2=6:goto 4210
4142 if sc>hsc(7) then for i=0 to 2:hsc(10-i)=hsc(9-i):hina(10-i)=hina(9-i):hico(10-i)=hico(9-i):next:hsc(7)=sc:hina(7)="":hico(7)=col:no2=7:goto 4210
4144 if sc>hsc(8) then for i=0 to 1:hsc(10-i)=hsc(9-i):hina(10-i)=hina(9-i):hico(10-i)=hico(9-i):next:hsc(8)=sc:hina(8)="":hico(8)=col:no2=8:goto 4210
4146 if sc>hsc(9) then hsc(10)=hsc(9):hina(10)=hina(9):hico(10)=hico(9):hsc(9)=sc:hina(9)="":hico(9)=col:no2=9 else hsc(10)=sc:hina(10)="":hico(10)=col:no2=10
4340 if ik=chr$(3) or ik=chr$(27) or ik=chr$(13) then sp_off(0,1):sp_on(14,53):for i=33 to 62:for i1=25 to 30:bg_put(0,i,i1,256*8+1):next:next:goto 4395
4342 if (m3<>0 or bu=bu1) and b=10 then sp_off(0,1):sp_on(14,53):for i=33 to 62:for i1=25 to 30:bg_put(0,i,i1,256*8+1):next:next:goto 4395
4345 i=len(hina(no2)):mog=0:moc=col
4350 if (m3<>0 or bu=bu1) and i<20 then mes=mid$(mes2,((int((mx-8)/8)) mod 30)+(int(my/8)-27)*30+1,1):hina(no2)=hina(no2)+mes:mog=0:mox=len(hina(no2))+42:moy=no2*2+3:moc=col:jiput():kb()
4355 i=len(hina(no2)):mog=0:moc=col
4360 if (m4<>0 or bu=bu2 or ik=chr$(29)) and i=1 then hina(no2)="":mes=" ":mox=42:moy=no2*2+3:jiput():kb() else if (m4<>0 or bu=bu2 or ik=chr$(29)) and i>1 then hina(no2)=left$(hina(no2),(i-1)):mes=" ":mox=42+i:moy=no2*2+3:jiput():kb()
5120 ik=inkey$(0):if ik=chr$(27) or ik=chr$(3) then goto 5800 else if ik="S" or ik="s" or ik="ト" then map_save() else if ik="l" or ik="L" or ik="リ" then map_load():goto 5050
5122 if ik="1" then iro=1 else if ik="2" then iro=2 else if ik="3" then iro=3 else if ik="4" then iro=4 else if ik="5" then iro=5 else if ik="6" then iro=6 else if ik="7" then iro=7
5123 if (ik="1" or ik="2" or ik="3" or ik="4" or ik="5" or ik="6" or ik="7") and gm=1 then goto 5050
5124 if (ik="1" or ik="2" or ik="3" or ik="4" or ik="5" or ik="6" or ik="7") and gm=0 then i=(pt1 mod 256):pt1=i+256*iro:i=(pt2 mod 256):pt2=i+256*iro
5130 if gm=1 then sp_on(0,0):mx=int(mx/(8+gm*8))*(8+gm*8)-1:my=int(my/(8+gm*8))*(8+gm*8)-1:sp_set(0,mx,my,124+256):i1=int(mx/(8+gm*0))-1:i2=int(my/(8+gm*0))-1
5135 if gm=0 then sp_on(0,0):mx=int(mx/8)*8-1:my=int(my/8)*8-1:sp_set(0,mx,my,124+256):i1=int(mx/8)-1:i2=int(my/8)-1
5140 i3=bg_get(n,i1,i2):i4=int(i3/256)
5150 if m3<>0 and gm=1 then pt1=i3:bg_put(n,6,30,pt1):bg_put(n,7,30,pt1+2):bg_put(n,6,31,pt1+1):bg_put(n,7,31,pt1+3)
5151 if m4<>0 and gm=1 then pt2=i3:bg_put(n,19,30,pt2):bg_put(n,20,30,pt2+2):bg_put(n,19,31,pt2+1):bg_put(n,20,31,pt2+3)
5154 /*
5155 if m3<>0 and gm=0 then goto 5300
5156 if m4<>0 and gm=0 then goto 5350
5160 if (ik="," or ik="z" or ik="Z" or ik="ツ") and gm=1 then goto 5200 else if (ik="." or ik="x" or ik="X" or ik="サ") and gm=0 then gm=1:bg_fill(1,256):goto 5250
5165 if ik=chr$(9) and gm=0 then ik="":mojiput() else if ik="/" or ik="*" then cls:locate 1,0:print"MAP("+str$(mno)+") =":locate 12,0:input mno:cls
5170 if ik=chr$(31) and gm=0 and nn<1000 then d_rol() else if ik=chr$(30) and gm=0 and nn>0 then u_rol()
5175 if ik=chr$(31) and gm=0 and nn<1000 then d_rol() else if ik=chr$(30) and gm=0 and nn>0 then u_rol()
6410 ik=inkey$(0):if ik="" then goto 6410 else if ik=chr$(9) or ik=chr$(13) or ik=chr$(27) then goto 6580 else if ik=chr$(29) or ik=chr$(8) or ik=chr$(127) then bg_put(1,(i1-1),i2,256+64):map(mno,nn+(31-i2),i1)=256+64:i1=i1-1:goto 6455